﻿
using System.Xml.Linq;
namespace PushNotificationsHelper.WindowsApp
{
    public class ToastXmlTemplateFactory
    {
        public static XDocument GetXDocumentForToastTemplate(ToastTemplate template)
        {
            return XDocument.Parse(GetXMLForToastTemplate(template));
        }

        public static string GetXMLForToastTemplate(ToastTemplate template)
        {
            string xmlTemplate = string.Empty;
            switch (template)
            {
                case ToastTemplate.ToastText01:
                    xmlTemplate = "<toast><visual><binding template=\"ToastText01\"><text id=\"1\">bodyText</text></binding></visual></toast>";
                    break;
                case ToastTemplate.ToastText02:
                    xmlTemplate = "<?xml version='1.0' encoding='utf-8'?><toast><visual><binding template=\"ToastText02\"> <text id=\"1\">headlineText</text> <text id=\"2\">bodyText</text></binding> </visual></toast>";
                    break;
                case ToastTemplate.ToastText03:
                    xmlTemplate = "<toast><visual><binding template=\"ToastText03\"><text id=\"1\">headlineText</text><text id=\"2\">bodyText</text></binding></visual></toast>";
                    break;
                case ToastTemplate.ToastText04:
                    xmlTemplate = "<toast><visual><binding template=\"ToastText04\"><text id=\"1\">headlineText</text><text id=\"2\">bodyText1</text><text id=\"3\">bodyText2</text></binding></visual></toast>";
                    break;
                case ToastTemplate.ToastImageAndText01:
                    xmlTemplate = "<toast><visual><binding template=\"ToastImageAndText01\"><image id=\"1\" src=\"image1\" alt=\"image1\"/><text id=\"1\">bodyText</text></binding></visual></toast>";
                    break;
                case ToastTemplate.ToastImageAndText02:
                    xmlTemplate = "<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"image1\" alt=\"image1\"/><text id=\"1\">headlineText</text><text id=\"2\">bodyText</text></binding></visual></toast>";
                    break;
                case ToastTemplate.ToastImageAndText03:
                    xmlTemplate = "<toast><visual><binding template=\"ToastImageAndText03\"><image id=\"1\" src=\"image1\" alt=\"image1\"/><text id=\"1\">headlineText</text><text id=\"2\">bodyText</text></binding></visual></toast>";
                    break;
                case ToastTemplate.ToastImageAndText04:
                    xmlTemplate = "<toast><visual><binding template=\"ToastImageAndText04\"><image id=\"1\" src=\"image1\" alt=\"image1\"/><text id=\"1\">headlineText</text><text id=\"2\">bodyText1</text><text id=\"3\">bodyText2</text></binding></visual></toast>";
                    break;
                default:
                    break;
            }
            return xmlTemplate;
        }


    }
}
